package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Getter@Setter
@JsonIgnoreProperties("handler")
public class Dynamic extends BaseDomain{
    //用户
    private User user;
    //动态内容
    private String content;
    //上传的图片
    private String picture;
    //创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date createTime;

    //动态,自连接
    private Dynamic dynamic;
    //该动态点赞的用户
    private List<User> users = new ArrayList();
    //当前登录用户是否给该条动态点过赞
    private int state;//0表示没有点赞过,1表示点赞过

    public String[] getImgArr(){
        if (StringUtils.hasLength(picture)) {
            String[] strings = picture.split(";");
            return strings;
        }
        return null;
    }
    //所有的评论
    private List<Comment> comment = new ArrayList<>();


}